<?php

// use Illuminate\Support\Facades\Schema;
use Jialeo\LaravelSchemaExtend\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitChip extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('chip', function (Blueprint $table) {
            $table->comment = '碎片表';

            $table->increments('id');
            $table->uuid('uuid')->index() ;

            $table->string('title', 20)->index()->comment('碎片标题');

            $table->string('icon')->nullable()->comment('碎片图标');

            $table->integer('stock')->default(0)->comment('库存');

            $table->integer('cover_total')->default(0)->comment('兑换数量');

            $table->integer('used_total')->default(0)->comment('已使用数量');

            $table->integer('list_weight')->default(100)->index()->comment('列表权重');
            
            $table->tinyInteger('status')->default(1)->index()->comment('0为未上架 1为已上架 '); // 0为未上架 1为已上架 

            $table->softDeletes();
            $table->timestamps();

        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::disableForeignKeyConstraints();
        Schema::dropIfExists('chip');
    }
}
